using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Deepcode.Flux.Core.Data;

namespace Deepcode.Flux.Core.Systems.Security
{
	/// <summary>
	/// Represents a single record in the AdministrationGroups table.
	/// </summary>
	public class AdministrationGroup
	{
		// Private field storage
		private int _PK_ID = -1;
		private string _GroupName = "";
		// Public property accessors
		public int PK_ID { get { return _PK_ID; } set { _PK_ID = value; } }
		public string GroupName { get { return _GroupName; } set { _GroupName = value; } }
		public AdminGroupPermission[] Permissions
		{
			get
			{
				return (new AdminGroupPermissions()).GetForGroup(PK_ID);
			}
		}
		// Default constructor		
		public AdministrationGroup() { }

		// Constructor loading data
		public AdministrationGroup(DataRow LoadRow)
		{
			_PK_ID = SQLUtility.DBNull(LoadRow["PK_ID"], -1);
			_GroupName = SQLUtility.DBNull(LoadRow["GroupName"], "");
		}
	}
}
